{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "_uuid": "570fb89bb4f7838b1d0fdff70b2935790e5dbdbe",
    "lang": "en"
   },
   "source": [
    "<center>\n",
    "<img src=\"https://habrastorage.org/files/fd4/502/43d/fd450243dd604b81b9713213a247aa20.jpg\">\n",
    "    \n",
    "## [mlcourse.ai](mlcourse.ai) – Open Machine Learning Course \n",
    "\n",
    "<center>Auteur: [Yury Kashnitskiy](http://yorko.github.io) <br>\n",
    "Traduit et édité par [Sergey Isaev](https://www.linkedin.com/in/isvforall/), [Artem Trunov](https://www.linkedin.com/in/datamove/), [Anastasia Manokhina](https://www.linkedin.com/in/anastasiamanokhina/), [Yuanyuan Pao](https://www.linkedin.com/in/yuanyuanpao/) et [Ousmane Cissé](https://github.com/oussou-dev)<br>Contenu soumis à la licence [Creative Commons CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "_uuid": "998fc5f76227ab1df9460a7b05c508304b14b3a6"
   },
   "source": [
    "# <center> Devoir #1 (démo)\n",
    "## <center>  Analyse exploratoire des données avec Pandas\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**Dans cette tâche, vous devez utiliser la librairie Pandas pour répondre à quelques questions liées au dataset (ensemble de données) [Adulte](https://archive.ics.uci.edu/ml/datasets/Adult). (Vous n'avez pas à télécharger les données - vous les trouverez ci-joints). Choisissez vos réponses via ce [formulaire](https://docs.google.com/forms/d/1uY7MpI2trKx6FLWZte0uVh3ULV4Cm_tDud0VDFGCOKg). C'est une version de démonstration. Ainsi, en soumettant le formulaire, vous verrez un lien vers le fichier .ipynb de la solution.**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "_uuid": "c322301ac858c748f8f80e63cf6f734fc70dde30",
    "lang": "en"
   },
   "source": [
    "Valeurs uniques de toutes les caractéristiques (pour plus d'informations, veuillez consulter les liens ci-dessus):\n",
    "- `age`: continuous.\n",
    "- `workclass`: Private, Self-emp-not-inc, Self-emp-inc, Federal-gov, Local-gov, State-gov, Without-pay, Never-worked.\n",
    "- `fnlwgt`: continuous.\n",
    "- `education`: Bachelors, Some-college, 11th, HS-grad, Prof-school, Assoc-acdm, Assoc-voc, 9th, 7th-8th, 12th, Masters, 1st-4th, 10th, Doctorate, 5th-6th, Preschool.\n",
    "- `education-num`: continuous.\n",
    "- `marital-status`: Married-civ-spouse, Divorced, Never-married, Separated, Widowed, Married-spouse-absent, Married-AF-spouse.\n",
    "- `occupation`: Tech-support, Craft-repair, Other-service, Sales, Exec-managerial, Prof-specialty, Handlers-cleaners, Machine-op-inspct, Adm-clerical, Farming-fishing, Transport-moving, Priv-house-serv, Protective-serv, Armed-Forces.\n",
    "- `relationship`: Wife, Own-child, Husband, Not-in-family, Other-relative, Unmarried.\n",
    "- `race`: White, Asian-Pac-Islander, Amer-Indian-Eskimo, Other, Black.\n",
    "- `sex`: Female, Male.\n",
    "- `capital-gain`: continuous.\n",
    "- `capital-loss`: continuous.\n",
    "- `hours-per-week`: continuous.\n",
    "- `native-country`: United-States, Cambodia, England, Puerto-Rico, Canada, Germany, Outlying-US(Guam-USVI-etc), India, Japan, Greece, South, China, Cuba, Iran, Honduras, Philippines, Italy, Poland, Jamaica, Vietnam, Mexico, Portugal, Ireland, France, Dominican-Republic, Laos, Ecuador, Taiwan, Haiti, Columbia, Hungary, Guatemala, Nicaragua, Scotland, Thailand, Yugoslavia, El-Salvador, Trinadad&Tobago, Peru, Hong, Holand-Netherlands.   \n",
    "- `salary`: >50K,<=50K"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "Valeurs uniques de toutes les caractéristiques (pour plus d'informations, veuillez consulter les liens ci-dessus):\n",
    "\n",
    "- `age`: continuous.\n",
    "- `workclass`: Private, Self-emp-not-inc, Self-emp-inc, Federal-gov, Local-gov, State-gov, Without-pay, Never-worked.\n",
    "- `fnlwgt`: continuous.\n",
    "- `education`: Bachelors, Some-college, 11th, HS-grad, Prof-school, Assoc-acdm, Assoc-voc, 9th, 7th-8th, 12th, Masters, 1st-4th, 10th, Doctorate, 5th-6th, Preschool.\n",
    "- `education-num`: continuous.\n",
    "- `marital-status`: Married-civ-spouse, Divorced, Never-married, Separated, Widowed, Married-spouse-absent, Married-AF-spouse.\n",
    "- `occupation`: Tech-support, Craft-repair, Other-service, Sales, Exec-managerial, Prof-specialty, Handlers-cleaners, Machine-op-inspct, Adm-clerical, Farming-fishing, Transport-moving, Priv-house-serv, Protective-serv, Armed-Forces.\n",
    "- `relationship`: Wife, Own-child, Husband, Not-in-family, Other-relative, Unmarried.\n",
    "- `race`: White, Asian-Pac-Islander, Amer-Indian-Eskimo, Other, Black.\n",
    "- `sex`: Female, Male.\n",
    "- `capital-gain`: continuous.\n",
    "- `capital-loss`: continuous.\n",
    "- `hours-per-week`: continuous.\n",
    "- `native-country`: United-States, Cambodia, England, Puerto-Rico, Canada, Germany, Outlying-US(Guam-USVI-etc), India, Japan, Greece, South, China, Cuba, Iran, Honduras, Philippines, Italy, Poland, Jamaica, Vietnam, Mexico, Portugal, Ireland, France, Dominican-Republic, Laos, Ecuador, Taiwan, Haiti, Columbia, Hungary, Guatemala, Nicaragua, Scotland, Thailand, Yugoslavia, El-Salvador, Trinadad&Tobago, Peru, Hong, Holand-Netherlands.   \n",
    "- `salary`: >50K,<=50K"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-12T06:54:25.800371Z",
     "start_time": "2019-09-12T06:54:21.318898Z"
    },
    "_uuid": "d3eb2411e23b7db11e4cbbb498a42752442a6f4c"
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-12T06:57:35.312373Z",
     "start_time": "2019-09-12T06:57:34.040046Z"
    },
    "_uuid": "c5119d1b8151029b4ff57735c4279b795ae492a2"
   },
   "outputs": [],
   "source": [
    "# lire le csv\n",
    "data = pd.read_csv(\n",
    "    \"adult.data.csv\"\n",
    ")  # destination du fichier à adapter (../dossier/adult.data.csv)\n",
    "\n",
    "#  afficher les 5 premières lignes du dataset\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**1. Combien d'hommes et de femmes (* caractéristique sex * ) sont représentés dans ce dataset ?**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:07.350899Z",
     "start_time": "2019-09-15T16:27:07.339474Z"
    },
    "_uuid": "d32cafcbe966dbdfa40c3017d16d6f8c96bfb3e2"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**2. Quel est l’âge moyen des femmes?**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:04.483099Z",
     "start_time": "2019-09-15T16:27:04.479781Z"
    },
    "_uuid": "64f60d928855107d8980875656dcdf3587d91646"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**3. Quel est le pourcentage de citoyens allemands (caractéristique *native-country*)?**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:02.040176Z",
     "start_time": "2019-09-15T16:27:02.028219Z"
    },
    "_uuid": "ca9807509692638bd945671ed7d8b4a5ad1f3626"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**4-5. Quels sont la moyenne et la déviation standard (écart-type) de l’âge pour ceux qui gagnent plus de 50k par an (caractéristique * salary *) et ceux qui gagnent moins de 50k par an?**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:26:58.666862Z",
     "start_time": "2019-09-15T16:26:58.656758Z"
    },
    "_uuid": "97948f0115f949913d211627151b5605bcd204fd"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**6. Est-il vrai que les personnes qui gagnent plus de 50k ont au moins terminé leurs études secondaires? (* education - Bachelors, Prof-school, Assoc-acdm, Assoc-voc, Masters * ou * Doctorat *)**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:12.311575Z",
     "start_time": "2019-09-15T16:27:12.298743Z"
    },
    "_uuid": "58f38ebfa2b0e1418a6a1a680d0743697f9876a2"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**7. Affichez les statistiques d'âge pour chaque race (caractéristique * race *) et chaque sexe (caractéristique * sex *). Utilisez * groupby () * et * describe () *. Trouvez l'âge maximum des hommes de race * Amer-Indian-Eskimo *.**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:14.668939Z",
     "start_time": "2019-09-15T16:27:14.663921Z"
    },
    "_uuid": "a4567b72200b583f7f2ee1583405d636c12169db"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**8. Parmi ceux qui gagnent plus de 50k, quel est l'état matrimonial (caractéristique marital-status) : marié ou célibataire  le plus représenté ?  \n",
    "On considère comme mariés ceux qui ont un marital-status commençant par Married (Married-civ-spouse, Married-spouse-absent or Married-AF-spouse), les autres sont considérés comme célibataires (bachelors).**  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:16.771136Z",
     "start_time": "2019-09-15T16:27:16.760606Z"
    },
    "_uuid": "5bb3a8524fcbd794707075ccf6aaf8dd0f30a3dd"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**9. Quel est le nombre d'heures maximum de travail par semaine effectué par une personne (caractéritique * hours-per-week *)?  \n",
    "  Combien de personnes travaillent autant, et quel est le pourcentage de celles qui gagnent beaucoup (>50k) parmi elles?**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:18.957584Z",
     "start_time": "2019-09-15T16:27:18.947076Z"
    },
    "_uuid": "3571468172fc4bcf34e10b3d6ab358d4e41f7ef4"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "lang": "fr"
   },
   "source": [
    "**10. Calculez le temps de travail moyen (*hours-per-week*) pour ceux qui sont peu et beaucoup payés (*salary*) pour chaque pays (*native-country*). Qu'obtient-on pour le Japon?**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-09-15T16:27:40.365058Z",
     "start_time": "2019-09-15T16:27:40.341814Z"
    },
    "_uuid": "75a93411f1e3b519afcc27c026aaa0c67eb526e9"
   },
   "outputs": [],
   "source": [
    "# ton code"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "hide_input": false,
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  },
  "nbTranslate": {
   "displayLangs": [
    "*"
   ],
   "hotkey": "alt-t",
   "langInMainMenu": true,
   "sourceLang": "en",
   "targetLang": "fr",
   "useGoogleTranslate": true
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
